package com.heima.baidu;

/**
 * @author rookie001
 * @creat 2023-06-09-15:49
 */

import com.baidu.aip.contentcensor.AipContentCensor;
import com.baidu.aip.contentcensor.EImgType;
import com.heima.utils.baidu.SampleToken;
import org.json.JSONObject;
import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class test {

//    //设置APPID/AK/SK
//    public static final String APP_ID = "34597486";
//    public static final String API_KEY = "SFNzUulLyAVwWGztGEYChcoB";
//    public static final String SECRET_KEY = "qdY1Pa61pjUqhTzFIiuxlpiZMmQxjDp9";
//
//    public static void main(String[] args) {
//        // 初始化一个AipContentCensor
//        AipContentCensor client = new AipContentCensor(APP_ID, API_KEY, SECRET_KEY);
//
//        // 调用接口
//        String path = "";
//        JSONObject res = client.textCensorUserDefined(path);
//        System.out.println(res.toString(2));
//
//    }
   /* public void sample(AipContentCensor client) {
        // 参数为本地图片路径
        String path = "test.jpg";
        JSONObject response = client.imageCensorUserDefined(path, EImgType.FILE, null);
        System.out.println(response.toString());

        // 参数为url
        String url = "http://testurl";
        response = client.imageCensorUserDefined(url, EImgType.URL, null);
        System.out.println(response.toString());

        // 参数为本地图片文件二进制数组
        byte[] file = readImageFile(imagePath);
        response = client.imageCensorUserDefined(file, null);
        System.out.println(response.toString());
    }*/
    @Test
    public void test(){
        String token = SampleToken.getToken();
        SampleToken.TextCenor(token,"尼玛");
    }
}


